#ifndef GLOBALS
	#define GLOBALS

	#define INT_TYPE 0x0001
	#define STR_TYPE 0x0002
	#define SYMBOL_TABLE_SIZE 100

	int current_byte;
	int reducing_else;

	struct cmd_node {
		int opcode;
		int param1;
		int param2;
		int byte_position;
		struct cmd_node *next;
	};

	struct symbol_table {
		int type;
		int position;
		char *name;
	};
	
	int symbol_table_counter;
	struct symbol_table symbol_table[SYMBOL_TABLE_SIZE];
	
	/* Lista que armazena os comandos */
	struct cmd_node **list;


	/*
	 * Prototipos
	 */
	void add_new_isymbol(int position, char *name);
	void dump_symbol_table();
	void declare_var(char *name);
	int get_position_by_name(char *name);

	/*
	 * Prototipos da lista
	 */
	void cmd_node_add(struct cmd_node **list, int opcode, int param1, int param2);
	void cmd_node_dump(struct cmd_node **list);

	/*
	 * OPCODE das operacoes
	 */
	#define IMUL 0x68
	#define IADD 0x60
	#define ISUB 0x64
	#define IDIV 0x6c
	#define BIPUSH 0x10
	#define ISTORE 0x36
	#define ILOAD 0x15
	#define IEQ 0x15
	#define IGT 0x15
	#define IF_ICMPEQ 0x9f	//eq succeeds if and only if value1 = value2
	#define IF_ICMPNE 0xa0	//ne succeeds if and only if value1 value2
	#define IF_ICMPLT 0xa1		//lt succeeds if and only if value1 < value2
	#define IF_ICMPGE 0xa2		//ge succeeds if and only if value1 value2
	#define IF_ICMPGT 0xa3		//gt succeeds if and only if value1 > value2
	#define IF_ICMPLE 0xa4		//le succeeds if and only if value1 value2	
	#define GOTO 0xa7

	/*
	 * Codigos de marcas no codigo
	 */
	#define LABEL_BRANCH_WHEN_FALSE 0x00a1
	#define LABEL_END_BLOCK 0x00a2
	 
	/*
	 * Variavel de decisao (true quando encontrar valor for encontrado)
	 */
	int int_found;
	int id_found;

	/*
	 * Indice de variaveis
	 */
	int var_index;

#endif 

